﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmBuscarProducto.aspx.cs" Inherits="Farmacia.net.Almacen.frmBuscarProducto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
    .style1
    {
        width: 100%;
    }
    .style2
    {
    }
    .style3
    {
            width: 179px;
            text-align: right;
        }
    .style4
    {
        width: 269px;
    }
    .style5
    {
            width: 107px;
            text-align: right;
        }
        .style6
        {
            width: 179px;
            font-weight: bold;
            text-align: right;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Buscar Productos</h2>
    <fieldset>
    <legend>Buscar</legend>
        <table class="style1">
            <tr>
                <td class="style6">
                    Criterio:</td>
                <td class="style2" colspan="2">
    <b> 
        <asp:TextBox ID="txtCriterio" runat="server" Width="363px"></asp:TextBox>
        </b>
                </td>
                <td>
    <b>
        <asp:Button ID="btnBuscar" runat="server" Text="Buscar" 
            onclick="btnBuscar_Click" />
        </b>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Proveedor :</td>
                <td class="style4">
    <b>
        <asp:DropDownList ID="ddlProveedor" runat="server" DataSourceID="OdsProveedor" 
            DataTextField="RazonSocial" DataValueField="RazonSocial" Height="25px" 
            Width="241px" AppendDataBoundItems="True" AutoPostBack="True">
            <asp:ListItem Selected="True" Value="%">Seleccionar Item</asp:ListItem>
        </asp:DropDownList>
        <asp:ObjectDataSource ID="OdsProveedor" runat="server" 
            onobjectcreating="OdsProveedor_ObjectCreating" 
            SelectMethod="GetAllFromProveedor" 
            TypeName="Farmacia.BussinessLogic.ProveedorBL"></asp:ObjectDataSource>
        </b>
                </td>
                <td class="style3">
                    Laboratorio:</td>
                <td>
                    <asp:DropDownList ID="ddlLab" runat="server" AppendDataBoundItems="True" 
                        AutoPostBack="True" DataSourceID="ODSLaboratorio" DataTextField="Nombre" 
                        DataValueField="Nombre" Height="25px" Width="241px">
                        <asp:ListItem Selected="True" Value="%">Seleccionar Item</asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="ODSLaboratorio" runat="server" 
                        onobjectcreating="ODSLaboratorio_ObjectCreating" 
                        SelectMethod="GetAllFromLaboratorio" 
                        TypeName="Farmacia.BussinessLogic.Almacen.Laborat.LaboratorioBL">
                    </asp:ObjectDataSource>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Grupo Farmacologico:</td>
                <td class="style4">
                    <asp:DropDownList ID="ddlGrupFarma" runat="server" AppendDataBoundItems="True" 
                        AutoPostBack="True" DataSourceID="odsGrupoFarma" DataTextField="Nombre" 
                        DataValueField="Nombre" Width="241px" Height="25px">
                        <asp:ListItem Selected="True" Value="%">Seleccionar</asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="odsGrupoFarma" runat="server" 
                        onobjectcreating="odsGrupoFarma_ObjectCreating" 
                        SelectMethod="GetAllGrupoFarmacologico" 
                        TypeName="Farmacia.BussinessLogic.Almacen.GrupoFarma.GrupoFarmaBL">
                    </asp:ObjectDataSource>
                </td>
                <td class="style3">
                    Principio Activo</td>
                <td>
                    <asp:DropDownList ID="ddlPrincipioActivo" runat="server" AppendDataBoundItems="True" 
                        AutoPostBack="True" DataSourceID="ODSPrincipioActivo" DataTextField="Nombre" 
                        DataValueField="Nombre" Height="25px" Width="241px">
                        <asp:ListItem Selected="True" Value="%">Seleccionar</asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="ODSPrincipioActivo" runat="server" 
                        onobjectcreating="ODSPrincipioActivo_ObjectCreating" 
                        SelectMethod="GetAllFromPrincActivo" 
                        TypeName="Farmacia.BussinessLogic.Almacen.PrincActivo.PrincipioActivoBL">
                    </asp:ObjectDataSource>
                </td>
            </tr>
            </table>
    </fieldset>
    <fieldset>
    <legend>Listado de Productos</legend>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" 
        AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" 
            ForeColor="#333333" GridLines="None" Width="100%" 
            style="font-size: medium">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:BoundField DataField="IdProducto" HeaderText="Id" 
                SortExpression="IdProducto" >
            <ItemStyle Font-Size="Small" />
            </asp:BoundField>
            <asp:BoundField DataField="Descripcion" HeaderText="Descripcion" 
                SortExpression="Descripcion" >
            <ItemStyle Font-Bold="True" Font-Size="Small" />
            </asp:BoundField>
            <asp:BoundField DataField="Proveedor" HeaderText="Proveedor" 
                SortExpression="Proveedor" >
            <ItemStyle Font-Size="Small" />
            </asp:BoundField>
            <asp:BoundField DataField="Laboratorio" HeaderText="Laboratorio" 
                SortExpression="Laboratorio" >
            <ItemStyle Font-Size="Small" />
            </asp:BoundField>
            <asp:BoundField DataField="GrupoFarmacologico" HeaderText="GrupoFarmacologico" 
                SortExpression="GrupoFarmacologico" >
            <ItemStyle Font-Size="Small" />
            </asp:BoundField>
            <asp:BoundField DataField="PrincActivo" HeaderText="PrincActivo" 
                SortExpression="PrincActivo" >
            <ItemStyle Font-Size="Small" />
            </asp:BoundField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="btnEditar" runat="server" 
                        ImageUrl="~/Images/1340864176_file_edit.png" Width="25px"
                        
                        PostBackUrl='<%# Eval("IdProducto","frmRegistrarProducto.aspx?acc=editar&amp;IdProducto={0}") %>' 
                        ToolTip="Editar" CommandName="Editar" CausesValidation="False"
                        />
                </ItemTemplate>
                <ItemStyle Width="25px" />
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="btnEliminar" runat="server" 
                        ImageUrl="~/Images/1340873477_Delete.png" 
                        OnClientClick="confirm('Desea Eliminar el Cliente');" CausesValidation="False" 
                        PostBackUrl='<%# Eval("IdProducto","frmRegistrarProducto.aspx?acc=eliminar&IdProducto={0}") %>' CommandName="Eliminar" 
                        />

                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="25px" />
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <EmptyDataTemplate>
            &nbsp;
        </EmptyDataTemplate>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" 
            Width = "50px"/>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Width="80px" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        SelectMethod="GetFromProdbyCriterioAndLaboratorioANDPrincipioActivoANDGrupoFarmacologicoANDPROVEEDOR" 
            TypeName="Farmacia.BussinessLogic.ProductoBL" 
            onobjectcreating="ObjectDataSource1_ObjectCreating">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtCriterio" DefaultValue="%" Name="Criterio" 
                PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="ddlLab" DefaultValue="%" 
                Name="Laboratorio" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="ddlPrincipioActivo" DefaultValue="%" 
                Name="PrincAct" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="ddlGrupFarma" DefaultValue="%" 
                Name="GrupFarm" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="ddlProveedor" DefaultValue="%" 
                Name="Proveedor" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </fieldset>
    
    

</asp:Content>
